package com.act262.demo;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ServletDemo2
 */
@WebServlet(urlPatterns = { "/ServletDemo2", "/demo2" }, initParams = {
		@WebInitParam(name = "name", value = "act262", description = "user name"),
		@WebInitParam(name = "age", value = "20") })
public class ServletDemo2 extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		System.out.println(this.getInitParameter("name"));
		System.out.println(this.getInitParameter("age"));
		System.out.println(this.getServletContext().getInitParameter("name"));

		System.out.println(this.getServletContext().getContextPath());

		resp.getWriter().write(this.getServletContext().getContextPath());

	}

}
